<template>
  <div class="box">
    <div v-if="flag==1">
        <div class="display_flex top_word">
            <p>
                <b>片块总数：</b>
                <span>{{wyInfo.reclaimCount}}</span>
            </p>
            <p>
                <b>抽查复核比例：</b>
                <span>{{wyInfo.extractiveRatio}}%</span>
            </p>
            <p>
                <b> 抽取片块数：</b>
                <span>{{wyInfo.extractiveLandCount}}</span>
            </p>
        </div>
      <div class="display_flex box_search">
        
        <div class="display_flex margin_rignt">
          <p>市级抽查复核片块：</p>
          <div>
            <el-select clearable v-model="needInfo.landId" placeholder="请选择">
              <el-option
                v-for="item in selectData"
                :key="item.value"
                :label="item.landName"
                :value="item.landId"
              ></el-option>
            </el-select>
          </div>
        </div>
        <div class="display_flex margin_rignt">
          <p>开始时间：</p>
          <div>
            <el-date-picker v-model="needInfo.startTime" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
          </div>
        </div>
        <div class="display_flex margin_rignt">
          <p>截止时间：</p>
          <div>
            <el-date-picker v-model="needInfo.finishTime" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
          </div>
        </div>
        <el-button @click="search" type="primary">查询</el-button>
      </div>
      <div class="table">
        <el-table v-loading="listLoading" :data="tableData" border style="width: 100%">
          <el-table-column type="index" show-overflow-tooltip label="序号" width="60"></el-table-column>
          <el-table-column prop="applicantName" label="权利人"></el-table-column>
          <el-table-column prop="num" label="身份证号"></el-table-column>
          <el-table-column prop="landName" label="复核地块"></el-table-column>
          <el-table-column prop="place" label="位置"></el-table-column>
          <el-table-column prop="time" label="复核时间"></el-table-column>
            <el-table-column prop="date" label="抽查复核结论">
              <template slot-scope="scope">
                {{scope.row.yesOrNo=="YES"?'通过':(scope.row.yesOrNo=="NO"?'不通过':'')}}
              </template>
            </el-table-column>
          <el-table-column label="操作" fixed="right">
            <!--  <template slot-scope="scope"> -->
            <template slot-scope="scope">
              <el-button size="mini" type="primary" @click="btnById(scope.row)">查看</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="pages">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage4"
          :page-sizes="[5, 10, 15, 20]"
          :page-size="needInfo.size"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        ></el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
import {
  supervisingInfo,
} from "@/api/hegezhengPeihao";
import {queryWyBasceInfo} from "@/api/shijiChouchaFuhe";
export default {
  data() {
    return {
      checked: true,
      flag: 1,
      selectData: [],
      value: "",
      tableData: [],
      currentPage4: 4,
      total:0,
      title: "",
      title1:'',
      seeImgDialog: false,
      videoDialog:false,
      imgArr: [
        { name: "抽查复核现场照片1", path: "" ,type:1},
        { name: "抽查复核现场照片2", path: "",type:1 },
        { name: "抽查复核视频", path: "",type:2 },
      ],
      listLoading:false,
      needInfo:{
        page:1,
        size:10,
        landId:'',
        applicantName:'',
        startTime:'',
        finishTime:'',
      },
      wyInfo:''
    };
  },
  created(){
    this.getData()
    this.getDataSelect()
    this.getWyBasceInfo()
  },
  methods: {
    getWyBasceInfo(){//获取外业抽查基本信息
      let obj={
        projectId:localStorage.getItem("projectId")
      }
      queryWyBasceInfo(obj).then(res=>{
        if(res.data)
        {
          this.wyInfo=res.data
        }
      })
    },
    //跳转详情
    btnById(row){
        console.log(row,"单条数据")
        this.$router.push({
          path: "/hegezhengPeihao/supervisionInformation/detail",
          query: {
            id: row.landId,
            vcr: row.vcr ? row.vcr : "",
            photo: row.photo ? row.photo : "",
            landName: row.landName,
            time:row.time,
          }
      });
    },
    //搜索
    search(){
      this.getData()
    },
    //查询列表
    getDataSelect(){
      var data={
        page:1,
        size:99999,
      }
      data["projectId"]=localStorage.getItem("projectId")
      supervisingInfo(data).then(res=>{
        this.selectData=res.data.rows
      })
    },
    //数据列表
    getData(){
      this.listLoading=true
      var data={}
      var objArr=this.needInfo
      for (var index in objArr) {
        if(objArr[index]!=''&&objArr[index]!=null){
          data[index]=objArr[index];
        }
      }
      data["projectId"]=localStorage.getItem("projectId")
      supervisingInfo(data).then(res=>{
        this.listLoading=false
        this.total=res.data.total
        this.tableData=res.data.rows
      })
    },
    btnSeeImg(title) {
      this.title = title;
      this.seeImgDialog = true;
    },
    btnSeeVideo(title){
        this.title1 = title;
      this.videoDialog = true;
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    }
  }
};
</script>

<style scoped>
.box {
  padding: 30px;
}
.display_flex {
  display: flex;
  align-items: center;
}
.top_word p{
    font-size: 14px;
    margin-bottom:20px;
    margin-right: 30px; 
}
.top_word p b{
    color: #444;
}
.top_word p span{
    font-size: 14px;
    color: #666;
}
.box_search .display_flex p {
  font-size: 14px;
  color: #333333;
}
.margin_rignt {
  margin-right: 30px;
}
.table {
  margin: 20px 0px;
}

.landInfo {
  border: 1px solid #efefef;
  box-sizing: border-box;
}
.back {
  margin: 20px;
}
.title_one {
  text-align: center;
  line-height: 40px;
  font-size: 20px;
  color: #444;
  font-weight: bold;
}
.title_little {
  font-size: 13px;
  color: #999;
  margin: 40px 20px 20px 30px;
}
.title .title_little span {
  margin-right: 30px;
}
.project_title {
  background: #f8f8f8;
  height: 50px;
  background: #f8f8f8;
  padding: 0px 30px;
  line-height: 50px;
  color: #48494d;
  font-size: 14px;
  font-weight: bold;
  border-top: 1px solid #efefef;
  border-bottom: 1px solid #efefef;
}
.project_img {
  padding: 30px;
}
.seeImg {
  text-align: center;
}
.project_result {
  padding: 30px;
}
.project_result .display_flex {
  margin-bottom: 20px;
  font-size: 13px;
  color: #444;
  width: 180px;
}
.pages{
  text-align: center;
}
</style>